#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <list>
#include <algorithm>
#include <string>
#include <QFile>
#include <QObject>
#include <map>
#include <QList>
#include "startupdatatext.h"
#include <QPair>
#include <QTextStream>
namespace Ui {
class MainWindow;
}

enum Level{one = 1, two = 2, three = 3, lucky = 20};


class MainWindow : public QMainWindow
{
    Q_OBJECT


    QString reward_one = QObject::tr("一等奖");
    QString reward_two = QObject::tr("二等奖");
    QString reward_three = QObject::tr("三等奖");
    QString reward_lucky = QObject::tr("幸运奖");
    using m_mIterator = std::multimap<Level, std::string>::iterator;

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void init();//进行抽奖名单的初始化
    void ReadFileData(QList<std::string> &list, QString FileName);
    void Go();//开始抽奖

    void WriteResult(QTextStream &in, Level l);

private slots:
    void on_comboBox_currentTextChanged(const QString &arg1);

    void on_pushButton_clicked();
    void UpdataTableItem(Level l);
    void GetUpdataTextMessage(QString qstr, bool s);

    void on_pushButton_2_clicked();

signals:
    void SendNewItem(Level l);

private:
    QList<std::string> *pListObj;
    QList<std::string>::iterator result_iter;
    Ui::MainWindow *ui;
    Level lvl;
    QFile *file;
    QList<std::string> strlist_one;
    QList<std::string> strlist_two;
    QList<std::string> strlist_three;
    QList<std::string> strlist_lucky;
    std::multimap<Level, std::string> mMap_SucessMan;

    StartUpdataText *uptext;
};

#endif // MAINWINDOW_H
